﻿Imports System.Data.OleDb
Imports System.Drawing

Public Class EditRecipe
    Inherits System.Web.UI.Page

    Public Shared editTags As Boolean = False

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load

        If Request.Params("ID") = "" Then Response.Redirect("Default.aspx")

        'Hide the Change Tags Placeholder
        plc_EditTags.Visible = False

        'Hide the New Ingredients Gridview Placeholders and Show the current one
        plc_CurrentIngredients.Visible = False
        plc_IngredientsNew.Visible = False
        plc_EditIngredientsPt1.Visible = False
        ' plc_EditIngredientsPt2.Visible = True

        'Hide the New methods Gridview Placeholders and Show the current one
        plc_CurrentMethods.Visible = False
        plc_NewMethods.Visible = False
        plc_EditMethodsPt1.Visible = False
        ' plc_EditMethodsPt2.Visible = True

        'Hide the Gallery Gridview Placeholders and Show the current one
        plc_CurrentPhotos.Visible = False
        plc_NewPhotos.Visible = False
        plc_EditPhotosPt1.Visible = False
        '  plc_EditPhotosPt2.Visible = True


        'Parse the URL to get the value in the Querystring
        Dim getQueryString As String = "0"
        getQueryString = Request.QueryString("ID")

        If Not IsPostBack Then

            'Ingredient panel visibilities
            plc_EditIngredientsPt2.Visible = False
            plc_EditIngredientsPt1.Visible = False
            plc_CurrentIngredients.Visible = True

            'Methods panel visibilities
            plc_EditMethodsPt2.Visible = False
            plc_EditMethodsPt1.Visible = False
            plc_CurrentMethods.Visible = True

            'Gallery panel visibilities
            plc_EditPhotosPt2.Visible = False
            plc_EditPhotosPt1.Visible = False
            plc_CurrentPhotos.Visible = True

            'Load current data from the RECIPE table
            Dim oleDbConn As New OleDb.OleDbConnection(ConfigurationManager.ConnectionStrings("recipeConnectionString").ConnectionString)
            Dim SqlString As String = "SELECT * from RECIPE WHERE REC_ID=@f1"
            Dim cmd As OleDbCommand = New OleDbCommand(SqlString, oleDbConn)
            cmd.CommandType = CommandType.Text
            cmd.Parameters.AddWithValue("@f1", getQueryString)
            oleDbConn.Open()

            Dim dr As OleDbDataReader = cmd.ExecuteReader
            If dr.HasRows Then
                dr.Read()
                If Not IsDBNull(dr("REC_NAME")) Then tb_RecipeName.Text = dr("REC_NAME")
                If Not IsDBNull(dr("TYPE_ID")) Then ddl_RecipeType.SelectedValue = dr("TYPE_ID")
                If Not IsDBNull(dr("REC_STARS")) Then rbl_RecipeStars.SelectedValue = dr("REC_STARS")
                If Not IsDBNull(dr("REC_SERVES")) Then tb_RecipeServes.Text = dr("REC_SERVES")
                If Not IsDBNull(dr("REC_TIME")) Then tb_RecipeTime.Text = dr("REC_TIME")
                If Not IsDBNull(dr("REC_DESC")) Then tb_RecipeDescription.Text = dr("REC_DESC")
            End If

            'Load current TagNames from the view RECIPE_TAG_TAGNAME_VIEW
            Dim TagOleDbConn As New OleDb.OleDbConnection(ConfigurationManager.ConnectionStrings("recipeConnectionString").ConnectionString)
            Dim TagSqlString As String = "SELECT * from RECIPE_TAG_TAGNAME_VIEW WHERE REC_ID=@f1"
            Dim TagCmd As OleDbCommand = New OleDbCommand(TagSqlString, TagOleDbConn)
            TagCmd.CommandType = CommandType.Text
            TagCmd.Parameters.AddWithValue("@f1", getQueryString)
            TagOleDbConn.Open()

            Dim TagIDString As String = ""
            Dim TagDr As OleDbDataReader = TagCmd.ExecuteReader
            While TagDr.Read()
                If TagIDString = "" Then
                    TagIDString = TagDr("TAG")
                Else
                    TagIDString = TagIDString & "," & TagDr("TAG")
                End If
            End While

            tb_CurrentTags.Enabled = False
            tb_CurrentTags.Text = TagIDString

        End If

    End Sub

    Protected Sub btn_CancelRecipe_Click(ByVal sender As Object, ByVal e As EventArgs) Handles btn_CancelRecipe.Click

        Dim usr As String = HttpContext.Current.User.Identity.Name
        Response.Redirect("~//Profile.aspx?User=" & usr)

    End Sub

    Protected Sub btn_EditRecipe_Click(ByVal sender As Object, ByVal e As EventArgs) Handles btn_EditRecipe.Click

        'Save the data of the RECIPE Table
        Dim oleDbConn As New OleDb.OleDbConnection(ConfigurationManager.ConnectionStrings("recipeConnectionString").ConnectionString)
        Dim SqlString As String = "UPDATE RECIPE SET REC_NAME=@f1,TYPE_ID=@f2,REC_STARS=@f3,REC_SERVES=@f4,REC_TIME=@f5,REC_DESC=@f6 WHERE REC_ID=@f7"

        Dim cmd As OleDbCommand = New OleDbCommand(SqlString, oleDbConn)
        cmd.CommandType = CommandType.Text
        cmd.Parameters.AddWithValue("@f1", tb_RecipeName.Text)
        cmd.Parameters.AddWithValue("@f2", ddl_RecipeType.SelectedValue)
        cmd.Parameters.AddWithValue("@f3", rbl_RecipeStars.SelectedValue)
        cmd.Parameters.AddWithValue("@f4", tb_RecipeServes.Text)
        cmd.Parameters.AddWithValue("@f5", tb_RecipeTime.Text)
        cmd.Parameters.AddWithValue("@f6", tb_RecipeDescription.Text)
        cmd.Parameters.AddWithValue("@f6", Request.QueryString("ID"))
        oleDbConn.Open()
        cmd.ExecuteNonQuery()

        'Only save tags if the user wanted to change them
        If editTags = True Then
            'Save the data of the TAGS table
            Dim TagsOleDbConn As New OleDb.OleDbConnection(ConfigurationManager.ConnectionStrings("recipeConnectionString").ConnectionString)
            Dim TagsSqlString As String = "INSERT into RECIPE_TAG(REC_ID,TAG_ID) Values (@f1,@f2)"
            TagsOleDbConn.Open()
            For Each cb As ListItem In chk_RecipeTag.Items
                If cb.Selected Then
                    'here is where the join to the table of tags and recipes is happening
                    Dim TagsComm As OleDbCommand = New OleDbCommand(TagsSqlString, TagsOleDbConn)
                    TagsComm.CommandType = CommandType.Text
                    'going through all checkboxes and associating the value behind the checkbox with the value of the recipe
                    TagsComm.Parameters.AddWithValue("@f1", Request.QueryString("ID"))
                    TagsComm.Parameters.AddWithValue("@f2", cb.Value)
                    TagsComm.ExecuteNonQuery()
                End If
            Next

            'This will take the content of the textbox and break it into an array of words
            Dim newTags = tb_RecipeNewTags.Text.Split(",")

            'Go through each new tag and add it to the table of tags
            For Each newTag In newTags

                '1. Add the new tag to the tag table
                Dim newTagSql As String = "INSERT INTO Tag(Tag) VALUES(@f1)"
                Dim cmdTag As OleDbCommand = New OleDbCommand(newTagSql, oleDbConn)
                cmdTag.CommandType = CommandType.Text
                cmdTag.Parameters.AddWithValue("@f1", newTag)
                cmdTag.ExecuteNonQuery()

                '2. Find the ID of the new tag in the tag table - 
                'The last item has the largest ID number. - Therefore SELECT TOP 1 in Table ORDERBY TAG_ID DESC
                Dim getLastIdCmd As OleDbCommand = New OleDbCommand("SELECT TOP 1 TAG_ID from TAG ORDER BY TAG_ID DESC", oleDbConn)
                'using ExecuteReader since I need to get a value back
                Dim dr = getLastIdCmd.ExecuteReader()
                dr.Read()
                Dim lastId = dr.GetValue(0)

                '3. Associate this last ID with the Recipe ID - this is like the first for loop above
                Dim cmdRecipe As OleDbCommand = New OleDbCommand(TagsSqlString, oleDbConn)
                cmdRecipe.CommandType = CommandType.Text
                cmdRecipe.Parameters.AddWithValue("@f1", Request.QueryString("ID"))
                'The tag foreign key ID is the ID we have just fetched
                cmdRecipe.Parameters.AddWithValue("@f2", lastId)
                cmdRecipe.ExecuteNonQuery()

            Next

        End If

        'Associating the Recipe_ID with the ingredients uploaded
        Dim ioleDbConn As New OleDb.OleDbConnection(ConfigurationManager.ConnectionStrings("recipeConnectionString").ConnectionString)
        Dim iSqlString = "UPDATE INGREDIENT SET REC_ID=@f1,ING_TEMP=@f2 WHERE ING_TEMP=@f3"
        Dim icommand As OleDbCommand = New OleDbCommand(iSqlString, ioleDbConn)
        icommand.CommandType = CommandType.Text
        icommand.Parameters.AddWithValue("@f1", Request.QueryString("ID"))
        icommand.Parameters.AddWithValue("@f2", False)
        icommand.Parameters.AddWithValue("@f3", True)
        ioleDbConn.Open()
        icommand.ExecuteNonQuery()

        'Associating the Recipe_ID with the methods uploaded
        Dim moleDbConn As New OleDb.OleDbConnection(ConfigurationManager.ConnectionStrings("recipeConnectionString").ConnectionString)
        Dim mSqlString = "UPDATE METHOD SET REC_ID=@f1,METHOD_TEMP=@f2 WHERE METHOD_TEMP=@f3"
        Dim mcommand As OleDbCommand = New OleDbCommand(mSqlString, moleDbConn)
        mcommand.CommandType = CommandType.Text
        mcommand.Parameters.AddWithValue("@f1", Request.QueryString("ID"))
        mcommand.Parameters.AddWithValue("@f2", False)
        mcommand.Parameters.AddWithValue("@f3", True)
        moleDbConn.Open()
        mcommand.ExecuteNonQuery()

        'Associating the Recipe_ID with the photos uploaded
        Dim poleDbConn As New OleDb.OleDbConnection(ConfigurationManager.ConnectionStrings("recipeConnectionString").ConnectionString)
        Dim pSqlString = "UPDATE GALLERY SET RECIPE_ID=@f1,GALLERY_TEMP=@f2 WHERE GALLERY_TEMP=@f3"
        Dim pcommand As OleDbCommand = New OleDbCommand(pSqlString, poleDbConn)
        pcommand.CommandType = CommandType.Text
        pcommand.Parameters.AddWithValue("@f1", Request.QueryString("ID"))
        pcommand.Parameters.AddWithValue("@f2", False)
        pcommand.Parameters.AddWithValue("@f3", True)
        poleDbConn.Open()
        pcommand.ExecuteNonQuery()

        'Find if an image is selected as the main image (from gridview) and if yes, get its id
        Dim row As GridViewRow = grd_NewPhotos.SelectedRow
        Dim recPhotoPath As String = ""
        Dim recID As String = ""

        If Not row Is Nothing Then
            Dim roleDbConn As New OleDb.OleDbConnection(ConfigurationManager.ConnectionStrings("recipeConnectionString").ConnectionString)
            Dim rSqlString = "UPDATE GALLERY SET GALLERY_MAIN=@f1 WHERE GALLERY_ID=@f2"
            Dim rcommand As OleDbCommand = New OleDbCommand(rSqlString, roleDbConn)
            rcommand.CommandType = CommandType.Text
            rcommand.Parameters.AddWithValue("@f1", True)
            rcommand.Parameters.AddWithValue("@f2", row.Cells(1).Text)
            roleDbConn.Open()
            rcommand.ExecuteNonQuery()

            'Read the path of the selected row from the Gallery ...
            Dim pathOleDbConn As New OleDb.OleDbConnection(ConfigurationManager.ConnectionStrings("recipeConnectionString").ConnectionString)
            Dim pathSqlString As String = "SELECT * from GALLERY WHERE GALLERY_ID=@f1"
            Dim pathCmd As OleDbCommand = New OleDbCommand(pathSqlString, pathOleDbConn)
            pathCmd.CommandType = CommandType.Text
            pathCmd.Parameters.AddWithValue("@f1", row.Cells(1).Text)
            pathOleDbConn.Open()
            Dim pathDr As OleDbDataReader = pathCmd.ExecuteReader
            If pathDr.HasRows Then
                pathDr.Read()
                If Not IsDBNull(pathDr("GALLERY_PATH")) Then recPhotoPath = pathDr("GALLERY_PATH")
                If Not IsDBNull(pathDr("RECIPE_ID")) Then recID = pathDr("RECIPE_ID")
            End If

        End If

        'Save the path of the main image into the recipe table (as the main image)
        Dim recoleDbConn As New OleDb.OleDbConnection(ConfigurationManager.ConnectionStrings("recipeConnectionString").ConnectionString)
        Dim recSqlString = "UPDATE RECIPE SET REC_IMAGE=@f1 WHERE REC_ID=@f2"
        Dim recCommand As OleDbCommand = New OleDbCommand(recSqlString, recoleDbConn)
        recCommand.CommandType = CommandType.Text
        recCommand.Parameters.AddWithValue("@f1", recPhotoPath)
        recCommand.Parameters.AddWithValue("@f2", recID)
        recoleDbConn.Open()
        recCommand.ExecuteNonQuery()


        Response.Redirect("~//Profile.aspx?User=" & (HttpContext.Current.User.Identity.Name))

    End Sub

    Protected Sub btn_ChangeTags_Click(ByVal sender As Object, ByVal e As EventArgs) Handles btn_ChangeTags.Click

        plc_EditTags.Visible = True
        editTags = True

        'Delete all current tags associated with this recipe
        Dim delRecipeTagDbConn As New OleDb.OleDbConnection(ConfigurationManager.ConnectionStrings("recipeConnectionString").ConnectionString)
        Dim delRecipeTagSqlString = "DELETE from RECIPE_TAG where REC_ID=@f1 "
        Dim delRecipeTagCommand As OleDbCommand = New OleDbCommand(delRecipeTagSqlString, delRecipeTagDbConn)
        delRecipeTagCommand.CommandType = CommandType.Text
        delRecipeTagCommand.Parameters.AddWithValue("@f1", Request.QueryString("ID"))
        delRecipeTagDbConn.Open()
        delRecipeTagCommand.ExecuteNonQuery()
        delRecipeTagCommand.Dispose()
        delRecipeTagDbConn.Close()
        delRecipeTagDbConn.Dispose()

    End Sub

    Protected Sub btnChangeIngredients_Click(ByVal sender As Object, ByVal e As EventArgs) Handles btnChangeIngredients.Click

        plc_EditIngredientsPt1.Visible = True
        plc_EditIngredientsPt2.Visible = True
        plc_CurrentIngredients.Visible = False
        plc_IngredientsNew.Visible = True
        btnChangeIngredients.Visible = False

        'Delete all current ingredients associated with this recipe
        Dim delIngDbConn As New OleDb.OleDbConnection(ConfigurationManager.ConnectionStrings("recipeConnectionString").ConnectionString)
        Dim delIngSqlString = "DELETE from INGREDIENT where REC_ID=@f1 "
        Dim delIngCommand As OleDbCommand = New OleDbCommand(delIngSqlString, delIngDbConn)
        delIngCommand.CommandType = CommandType.Text
        delIngCommand.Parameters.AddWithValue("@f1", Request.QueryString("ID"))
        delIngDbConn.Open()
        delIngCommand.ExecuteNonQuery()
        delIngCommand.Dispose()
        delIngDbConn.Close()
        delIngDbConn.Dispose()

    End Sub

    Protected Sub btnChangeMethods_Click(ByVal sender As Object, ByVal e As EventArgs) Handles btnChangeMethods.Click

        plc_EditMethodsPt1.Visible = True
        plc_EditMethodsPt2.Visible = True
        plc_CurrentMethods.Visible = False
        plc_NewMethods.Visible = True
        btnChangeMethods.Visible = False

        'Delete all current methods associated with this recipe
        Dim delMethDbConn As New OleDb.OleDbConnection(ConfigurationManager.ConnectionStrings("recipeConnectionString").ConnectionString)
        Dim delMethSqlString = "DELETE from METHOD where REC_ID=@f1 "
        Dim delMethCommand As OleDbCommand = New OleDbCommand(delMethSqlString, delMethDbConn)
        delMethCommand.CommandType = CommandType.Text
        delMethCommand.Parameters.AddWithValue("@f1", Request.QueryString("ID"))
        delMethDbConn.Open()
        delMethCommand.ExecuteNonQuery()
        delMethCommand.Dispose()
        delMethDbConn.Close()
        delMethDbConn.Dispose()

    End Sub

    Protected Sub btnChangePhotos_Click(ByVal sender As Object, ByVal e As EventArgs) Handles btnChangePhotos.Click

        plc_EditPhotosPt1.Visible = True
        plc_EditPhotosPt2.Visible = True
        plc_CurrentPhotos.Visible = False
        plc_NewPhotos.Visible = True
        btnChangePhotos.Visible = False

        'Delete all current photos associated with this recipe
        Dim delMethDbConn As New OleDb.OleDbConnection(ConfigurationManager.ConnectionStrings("recipeConnectionString").ConnectionString)
        Dim delMethSqlString = "DELETE from GALLERY where RECIPE_ID=@f1 "
        Dim delMethCommand As OleDbCommand = New OleDbCommand(delMethSqlString, delMethDbConn)
        delMethCommand.CommandType = CommandType.Text
        delMethCommand.Parameters.AddWithValue("@f1", Request.QueryString("ID"))
        delMethDbConn.Open()
        delMethCommand.ExecuteNonQuery()
        delMethCommand.Dispose()
        delMethDbConn.Close()
        delMethDbConn.Dispose()

        'Check if the Gallery Table has any temporary files and delete them
        Dim delGalleryDbConn As New OleDb.OleDbConnection(ConfigurationManager.ConnectionStrings("recipeConnectionString").ConnectionString)
        Dim delGallerySqlString = "DELETE from GALLERY where GALLERY_TEMP=@f1 "
        Dim delGalleryCommand As OleDbCommand = New OleDbCommand(delGallerySqlString, delGalleryDbConn)
        delGalleryCommand.CommandType = CommandType.Text
        delGalleryCommand.Parameters.AddWithValue("@f1", True)
        delGalleryDbConn.Open()
        delGalleryCommand.ExecuteNonQuery()
        delGalleryCommand.Dispose()
        delGalleryDbConn.Close()
        delGalleryDbConn.Dispose()

    End Sub

    Protected Sub btn_AddToIngredients_Click(ByVal sender As Object, ByVal e As EventArgs) Handles btn_AddToIngredients.Click

        plc_EditIngredientsPt1.Visible = False
        plc_IngredientsNew.Visible = True

        Dim oleDbConn As New OleDb.OleDbConnection(ConfigurationManager.ConnectionStrings("recipeConnectionString").ConnectionString)
        oleDbConn.Open()
        Dim newIngSql As String = "INSERT INTO INGREDIENT (ING_QTY,ING_DESC,ING_TEMP) VALUES (@f1,@f2,@f3)"
        Dim cmdTag As OleDbCommand = New OleDbCommand(newIngSql, oleDbConn)
        cmdTag.CommandType = CommandType.Text
        cmdTag.Parameters.AddWithValue("@f1", ing_Qty.Text)
        cmdTag.Parameters.AddWithValue("@f2", ing_Desc.Text)
        cmdTag.Parameters.AddWithValue("@f3", True)
        cmdTag.ExecuteNonQuery()
        cmdTag.Dispose()
        ing_Qty.Text = ""
        ing_Desc.Text = ""

        'Refresh ingredients gridview
        Dim fillIngredients As String = "SELECT * FROM INGREDIENT WHERE ING_TEMP=@f1"
        Dim fillIngredientsCmd As OleDbCommand = New OleDbCommand(fillIngredients, oleDbConn)
        fillIngredientsCmd.CommandType = CommandType.Text
        fillIngredientsCmd.Parameters.AddWithValue("@f1", True)
        Dim ingDataReader = fillIngredientsCmd.ExecuteReader()
        grd_IngredientsNew.DataSource = ingDataReader
        grd_IngredientsNew.DataBind()
        oleDbConn.Close()
        oleDbConn.Dispose()

    End Sub


    Protected Sub btn_btn_AddToMethods_Click(ByVal sender As Object, ByVal e As EventArgs) Handles btn_AddToMethods.Click

        plc_EditMethodsPt1.Visible = False
        plc_NewMethods.Visible = True

        Dim newMethOleDbConn As New OleDbConnection(ConfigurationManager.ConnectionStrings("recipeConnectionString").ConnectionString)
        newMethOleDbConn.Open()
        Dim newMethSql As String = "INSERT INTO METHOD (METHOD_DESC,METHOD_TEMP) VALUES (@f1,@f2)"
        Dim newMethCmd As OleDbCommand = New OleDbCommand(newMethSql, newMethOleDbConn)
        newMethCmd.CommandType = CommandType.Text
        newMethCmd.Parameters.AddWithValue("@f1", meth_Desc.Text)
        newMethCmd.Parameters.AddWithValue("@f2", True)
        newMethCmd.ExecuteNonQuery()
        newMethCmd.Dispose()
        meth_Desc.Text = ""

        'Refresh methods gridview
        Dim fillIngredients As String = "SELECT * FROM METHOD WHERE METHOD_TEMP=@f1"
        Dim fillIngredientsCmd As OleDbCommand = New OleDbCommand(fillIngredients, newMethOleDbConn)
        fillIngredientsCmd.CommandType = CommandType.Text
        fillIngredientsCmd.Parameters.AddWithValue("@f1", True)
        Dim ingDataReader = fillIngredientsCmd.ExecuteReader()
        grd_MethodNew.DataSource = ingDataReader
        grd_MethodNew.DataBind()
        newMethOleDbConn.Close()
        newMethOleDbConn.Dispose()

    End Sub

    Protected Sub btn_AddToGallery_Click(ByVal sender As Object, ByVal e As EventArgs) Handles btn_AddToGallery.Click

        plc_EditPhotosPt1.Visible = False
        plc_NewPhotos.Visible = True

        Dim img_Size As Integer = 0
        Dim img_width As Integer = 0
        Dim img_height As Integer = 0

        Dim myGUID As New System.Guid
        myGUID = Guid.NewGuid()
        Dim newGFileName = myGUID.ToString() + ".jpg"

        If fup_Gallery.HasFile Then
            fup_Gallery.SaveAs(Request.MapPath("Image") & "/" & newGFileName)
            Dim infoReader As System.IO.FileInfo
            infoReader = My.Computer.FileSystem.GetFileInfo(Request.MapPath("Image") & "/" & newGFileName)
            img_Size = infoReader.Length
            Dim fName As String = Request.MapPath("Image") & "/" & newGFileName
            Dim img As Image = Image.FromFile(fName)
            img_height = img.Size.Height
            img_width = img.Size.Width
            img.Dispose()
        End If

        Dim oleDbConn As New OleDb.OleDbConnection(ConfigurationManager.ConnectionStrings("recipeConnectionString").ConnectionString)
        oleDbConn.Open()
        Dim newImageSql As String = "INSERT INTO GALLERY (GALLERY_PATH,GALLERY_SIZE,GALLERY_WIDTH,GALLERY_HEIGHT,GALLERY_TEMP) VALUES (@f1,@f2,@f3,@f4,@f5)"
        Dim cmdTag As OleDbCommand = New OleDbCommand(newImageSql, oleDbConn)
        cmdTag.CommandType = CommandType.Text
        cmdTag.Parameters.AddWithValue("@f1", "Image/" & newGFileName)
        cmdTag.Parameters.AddWithValue("@f2", img_Size)
        cmdTag.Parameters.AddWithValue("@f3", img_width)
        cmdTag.Parameters.AddWithValue("@f4", img_height)
        cmdTag.Parameters.AddWithValue("@f5", True)
        cmdTag.ExecuteNonQuery()
        cmdTag.Dispose()

        'Refresh gallery gridview
        Dim fillGallery As String = "SELECT * FROM GALLERY WHERE GALLERY_TEMP=@f1"
        Dim fillGalleryCmd As OleDbCommand = New OleDbCommand(fillGallery, oleDbConn)
        fillGalleryCmd.CommandType = CommandType.Text
        fillGalleryCmd.Parameters.AddWithValue("@f1", True)
        Dim galDataReader = fillGalleryCmd.ExecuteReader()
        grd_NewPhotos.DataSource = galDataReader
        grd_NewPhotos.DataBind()
        oleDbConn.Close()
        oleDbConn.Dispose()
    End Sub


End Class